#pragma once
#include "RBTree.h"

namespace yjj
{
	template<class K>
	class set
	{
		struct SetKeyOfT
		{
			const K& operator()(const K& key)
			{
				return key;
			}
		};
	public:
		typedef typename RBTree<K, K, SetKeyOfT>::iterator iterator;
		//typedef typename RBTree<K, K, SetKeyOfT>::const_itertaor const_iterator;

		iterator begin()
		{
			return _t.begin();
		}

		iterator end()
		{
			return _t.end();
		}
		bool Insert(const K& key)
		{
			return _t.Insert(key); 
		}
	private: 
		RBTree<K, K, SetKeyOfT> _t;
	};

	void test_set()
	{
		set<int> s;
		s.Insert(1);
		s.Insert(3);
		s.Insert(2);
		s.Insert(5);

		set<int>::iterator it = s.begin();
		while (it != s.end())
		{
			cout << *it << endl;
		}
	}

}
